<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>local.ssl.create</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<style>
    #app p{
        color:grey;
        font-size: 14px;
    }
    #app .code{
        color: chocolate;
        font-size: 15px;
    }
</style>
<body>
    
    <div id="app">
        <div><input v-model="domain"></div>
        <p>#第一步，为服务器端和客户端准备公钥、私钥</p>
        <p># 生成服务器端私钥</p>
        <p class="code">openssl genrsa -out {{domain}}.key 1024</p>
        <p># 生成服务器端公钥</p>
        <p class="code">openssl rsa -in {{domain}}.key -pubout -out {{domain}}.pem</p>
        <p> #第二步，生成 CA 证书</p>
        <p> # 生成 CA 私钥</p>
        <p class="code">openssl genrsa -out {{domain}}.ca.key 1024</p>
        <p class="code">openssl req -new -key {{domain}}.ca.key -out {{domain}}.ca.csr</p>
        <p class="code">openssl x509 -req -in {{domain}}.ca.csr -signkey {{domain}}.ca.key -out {{domain}}.ca.crt</p>
        <p>#第三步，生成服务器端证书</p>
        <p># 服务器端需要向 CA 机构申请签名证书，在申请签名证书之前依然是创建自己的 CSR 文件</p>
        <p class="code">openssl req -new -key {{domain}}.key -out {{domain}}.csr</p>
        <p># 向自己的 CA 机构申请证书，签名过程需要 CA 的证书和私钥参与，最终颁发一个带有 CA 签名的证书</p>
        <p class="code">openssl x509 -req -CA {{domain}}.ca.crt -CAkey {{domain}}.ca.key -CAcreateserial -in {{domain}}.csr -out {{domain}}.crt</p>
        <p>#第四步，生成cer文件</p>
        <p>#使用openssl 进行转换</p>
        <p class="code">openssl x509 -in {{domain}}.crt -out {{domain}}.cer -outform der</p>


        <div>
    	<textarea style="width: 100%;height: 160px;">
<VirtualHost *:443>
	DocumentRoot "E:/wwwgit/{{domain}}/main"
	ServerName {{domain}}:443
	SSLEngine on
	SSLProtocol TLSv1 TLSv1.1 TLSv1.2
	SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL
	SSLCertificateFile "C:/phpStudy/PHPTutorial/Apache/conf/ssl/{{domain}}/{{domain}}.crt"
	SSLCertificateKeyFile "C:/phpStudy/PHPTutorial/Apache/conf/ssl/{{domain}}/{{domain}}.key"
	SSLCertificateChainFile "C:/phpStudy/PHPTutorial/Apache/conf/ssl/{{domain}}/{{domain}}.ca.crt"
	<FilesMatch "\.(cgi|shtml|phtml|php)$">
   	SSLOptions +StdEnvVars
	</FilesMatch>
	<Directory "E:/wwwgit/{{domain}}/main">
    	SSLOptions +StdEnvVars
	</Directory>
	BrowserMatch ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0   
</VirtualHost> 
    	</textarea>
    </div>
    </div>

    

    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                domain: 'www.llton.com'
            }
        })
    </script>
</body>

</html>